using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using Spike_EBC_Designer.ViewModel;

namespace Spike_EBC_Designer
{
    public class FilesystemAdapter
    {
        public static Grid Load(string filename)
        {
            using (var fs = new FileStream(filename, FileMode.Open))
            {
                var bf = new BinaryFormatter();
                return bf.Deserialize(fs) as Grid;
            }
        }

        public static void Store(string filename, Grid grid)
        {
            using (var fs = new FileStream(filename, FileMode.Create))
            {
                var bf = new BinaryFormatter();
                bf.Serialize(fs, grid);
            }
        }
    }
}